<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <functional-button @click="handleClick" ></functional-button>
    </div>
    <script src="vue.js"></script>
    <script>
        const FunctionalButton = {
            functional:true,
            render(createElement,context){
               /*  let listeners = {
                    click:handleClick
                } */
                console.log(context)
                console.log(context.data)
                console.log(context.listeners === context.data.on);
                return createElement(
                    'button',
                    {
                        ...context.data,
                        on:context.listeners
                    },
                    'Click'
                );
            }
        }
        var vm = new Vue({
            el:'#app',
            components:{
                'functional-button':FunctionalButton
            },
            methods:{
                handleClick(){
                    console.log('clicked')
                }
            }
        });
    </script>
</body>
</html>